<template>
    <div class="parent">
        <header class="header">
            <x-header class="headerContent" :left-options="{showBack: false}"><span class="title">掌上缴费</span></x-header>
        </header>
        <div class="parent_content">
            <div class="swiper">
                <swiper auto :show-dots="show_dots">
                    <swiper-item class="swiper-demo-img" v-for="(item, index) in demo04_list" :key="index"><img class="img" :src="item.BannerImgURL"></swiper-item>
                </swiper>
            </div>
            <div class="choice">
                <ul class="list">
                    <router-link to="/Home/Repair">
                        <li class="listItem">
                            <span class="icon">
                                <i class="iconfont icon-baoxiu icons"></i>
                            </span>
                            <span class="iconText">故障报修</span>
                        </li>
                    </router-link>
                    <router-link to="/Home/Paydetail">
                        <li class="listItem">
                            <span class="icon">
                                <i class="iconfont icon-zaixianjiaofei icons"></i>
                            </span>
                            <span class="iconText">在线缴费</span>
                        </li>
                    </router-link>
                    <router-link to="/Home/Reporting">
                        <li class="listItem">
                            <span class="icon">
                                <i class="iconfont icon-shouyefapiao icons"></i>
                            </span>
                            <span class="iconText">电子发票</span>
                        </li>
                    </router-link>
                    <router-link to="/Find/Weather">
                        <li class="listItem">
                            <span class="icon">
                                <i class="iconfont icon-shouyetianqi icons"></i>
                            </span>
                            <span class="iconText">实时天气</span>
                        </li>
                    </router-link>
                </ul>
            </div>
            <div class="titleTop">
                <p class="titleTop_line">
                    <span class="line">
                        <span class="line_one"></span>
                        <span class="line_two"></span>
                    </span>
                    <span class="text">热门咨询</span>
                </p>
            </div>
            <scroller lock-x height="7.68rem" @on-scroll="onScroll" ref="scrollerEvent">
                <div class="panel" ref="panel">
                    <ul class="panel_list">
                        <li class="panel_listItem" @click="goDetail(index, item)" v-for="(item, index) in datalist" :key="index">
                            <div class="pic">
                                <img :src="item.hotImgURL" alt="">
                            </div>
                            <div class="content">
                                <span class="titleContent">{{item.articleTitle}}</span>
                                <span class="content_cont">{{item.remark}}</span>
                            </div>
                        </li>
                    </ul>
                </div>
            </scroller>
        </div>
        <Tabs></Tabs>
    </div>
</template>
<script>
import { XHeader, Swiper, SwiperItem, Scroller  } from 'vux'
import Tabs from '../components/tabBar'
import Qs from 'qs'
import API from '../config/api_user.js'
export default {
    name: 'Home',
    components: {
        XHeader,
        Swiper,
        SwiperItem,
        Scroller,
        Tabs
    },
    data () {
        return {
            show_dots: false,
            demo04_list: [],
            datalist: [],
            scrollTop: 0
        }
    },
    created () {
        this.hotCounselling()
        this.loopSrc()
    },
    mounted () {
        this.$nextTick(() => {
            this.$refs.scrollerEvent.reset({top: 0})
        })
    },
    methods: {
        hotCounselling () {
            let params = {
                articleTypeID:'',
                articleTitle:'',
                isHotShow: 1,
                isBannerShow: 0
            }
            API.getArticleList(params).then(res => {
                this.datalist = res.page
            })
        },
        loopSrc () {
            let params = {
                articleTypeID:'',
                articleTitle:'',
                isHotShow: 0,
                isBannerShow: 1
            }
            API.getArticleList(params).then(res => {
                this.demo04_list = res.page
            })
        },
        goDetail (index, item) {
            this.$router.push({
                path: '/Home/hotNews',
                query: {
                    item: item,
                    mc: '热门咨询'
                }
            })
        },
        onScroll (pos) {
            this.scrollTop = pos.top
        },
    }
}
</script>
<style scoped lang="less">
.parent{
    width: 100%;
    height: 100%;
    background:rgba(250,250,250,1);
}
.parent_content{
    width: 100%;
}
.header{
    width: 100%;
    height: 1.333333rem;
}
.title{
    font-size: 16px;
    font-family:ArialMT;
    color:rgba(255,255,255,1);
    line-height:18px;
    letter-spacing:1px;
}
.headerContent{
    width: 100%;
    height: 100%;
    background:linear-gradient(127deg,rgba(255,199,38,1) 0%,rgba(249,151,22,1) 100%);
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
}
.titleTop{
    width: 100%;
    height: 1.333333rem;
    background: #fff;
    padding: 0 .266667rem;
    position: relative;
    .titleTop_line{
        width: 100%;
        height: 100%;
        display: flex;
        flex-direction: row;
        justify-content: flex-start;
        align-items: center;
        .line{
            display: block;
            width: .266667rem;
            height: .453333rem;
            display: flex;
            flex-direction: row;
            justify-content: flex-start;
            align-items: center;
            margin-right: .053333rem;
            .line_one{
                display: block;
                width: .08rem;
                height: 100%;
                background: #FFC726;
                margin-right: .04rem;
            }
            .line_two{
                display: block;
                width: .053333rem;
                height: 100%;
                background: #FFC726;
            }
        }
        .text{
            font-size: 18px;
            color:rgba(255,199,38,1);
            font-family:Arial-BoldMT;
            font-weight:normal;
            letter-spacing:1px;
        }
    }
}
.titleTop:after{
        content: '';
        position: absolute;
        left: 0;
        bottom: 0;
        background: #cccccc;
        width: 100%;
        height: 1px;
        -webkit-transform: scaleY(0.5);
        transform: scaleY(0.5);
        -webkit-transform-origin: 0 0;
        transform-origin: 0 0;
    }
.swiper{
    width: 100%;
    height: 4.906667rem;
    .swiper-demo-img {
        width: 100%;
        height: 100%;
        .img{
            display: block;
            width: 100%;
            height: 100%;
        }
    }
}

.panel{
    width: 100%;
    overflow:hidden;
    padding-bottom: 1.546667rem;
    .panel_list{
        width: 100%;
        background: #fff;
        padding: 0 .266667rem;
        .panel_listItem{
            width: 100%;
            height: 2.56rem;
            display: flex;
            flex-direction: row;
            justify-content: flex-start;
            align-items: center;
            position: relative;
            .pic{
                width: 2.133333rem;
                height: 2.133333rem;
                margin-right: .2rem;
                img{
                    display: block;
                    width: 100%;
                    height: 100%;
                    border-radius: 6px;
                }
            }
            .content{
                width: 80%;
                height: 100%;
                display: flex;
                flex-direction: column;
                justify-content: flex-start;
                align-items: flex-start;
                padding: .266667rem 0;
                .titleContent{
                    display: block;
                    width: 100%;
                    height: .6rem;
                    font-size:14px;
                    font-family:PingFangSC-Regular;
                    font-weight:400;
                    color:rgba(102,102,102,1);
                    letter-spacing:1px;
                    display: -webkit-box;
                    overflow: hidden;
                    -webkit-line-clamp: 1;
                    -webkit-box-orient: vertical;
                }
                .content_cont{
                    width: 100%;
                    height: 1.4rem;
                    font-size:12px;
                    font-family:PingFangSC-Regular;
                    font-weight:400;
                    color:rgba(151,151,151,1);
                    line-height:17px;
                    letter-spacing:1px;
                    display: -webkit-box;
                    overflow: hidden;
                    -webkit-line-clamp: 3;
                    -webkit-box-orient: vertical;
                }
            }
        }
        .panel_listItem:after{
            content: '';
            position: absolute;
            left: 0;
            bottom: 0;
            background: #cccccc;
            width: 100%;
            height: 1px;
            -webkit-transform: scaleY(0.5);
            transform: scaleY(0.5);
            -webkit-transform-origin: 0 0;
            transform-origin: 0 0;
        }
    }
}
.choice{
    width: 100%;
    padding: .24rem .266667rem;
    // padding-top: .613333rem;
    // padding-bottom: .4rem;
    .list{
        width: 100%;
        height: 2rem;
        background: #fff;
        border-radius: 0.05rem;
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 0 .6rem;
        .listItem{
            width: 1.866667rem;
            height: 1.6rem;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
            align-items: center;
            .icon{
                display: block;
                width: 1.066667rem;
                height: 1.066667rem;
                background: linear-gradient(44deg,rgba(255,199,38,1) 0%,rgba(249,151,22,1) 100%);
                border-radius: 50%;
                display: flex;
                flex-direction: row;
                justify-content: center;
                align-items: center;
                .icons{
                    font-size: 20px;
                    color: #fff;
                }
            }
            .iconText{
                font-size:12px;
                font-family:PingFangSC-Regular;
                font-weight:400;
                color:rgba(82,82,82,1);
                line-height:17px;
                letter-spacing:1px;
            }
        }
    }
}
</style>
